package com.doraro.platform.module.user.model.vo;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.doraro.platform.module.device.model.param.cond.BaseCond;
import com.doraro.platform.module.user.model.entity.SysJob;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;

@Data
public class JobCond implements BaseCond<SysJob> {
    @ApiModelProperty(value = "接受任务的订单id")
    private String orderId;

    @ApiModelProperty(value = "工作量(天)")
    private Integer workload;

    @ApiModelProperty(value = "自行维修率(小数")
    private BigDecimal selfRepaireRate;

    @ApiModelProperty(value = "单次维修时间(天)")
    private Integer singleRepairTime;

    @Override
    public LambdaQueryWrapper<SysJob> condition() {
        return new LambdaQueryWrapper<SysJob>()
                .like(StringUtils.isNotBlank(orderId), SysJob::getOrderId, orderId)
                .eq(workload != null, SysJob::getWorkload, workload)
                .like(selfRepaireRate != null, SysJob::getSelfRepaireRate, selfRepaireRate)
                .eq(singleRepairTime != null, SysJob::getSingleRepairTime, singleRepairTime)

                ;
    }
}
